package com.aistar.task;

import com.aistar.util.WebSocketServerUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Configuration
@EnableScheduling
public class OnlineCounterTask {
    private Log log = LogFactory.getLog(OnlineCounterTask.class);

    @Scheduled(cron = "0 5/5 * * * ?") // 每5min运行一次
    private void run() {
        log.info("当前已登录人数：" + WebSocketServerUtil.getOnlineCount());
    }
}
